.for-container {
    font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
    display: -webkit-box;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    flex-direction: column;
    height: 600px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 12px;
    background: #fff;
    font-size: 14px;
    width: 100%;

    ul,
    ol,
    li {
        margin: 0;
        padding: 0;
    }

    &.for-fullscreen {
        position: fixed;
        z-index: 99999;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        height: 100% !important;
    }

    > div {
        &:first-child {
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
        }
    }

    .for-hidden {
        display: none;
    }

    .for-toolbar {
        font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
        display: -webkit-box;
        display: flex;
        -webkit-box-pack: justify;
        justify-content: space-between;
        padding: 0 6px;
        border-bottom: 1px solid #ddd;
        color: #555;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        flex-direction: row;

        > .for-pc,
        .for-mobile,
        .for-right-pc,
        .for-right-mobile {
            > ul {
                display: -webkit-box;
                display: flex;

                > li {
                    display: -webkit-box;
                    display: flex;
                    -webkit-box-align: center;
                    align-items: center;
                    padding: 4px 6px;
                    margin: 8px 4px;
                    border-radius: 4px;
                    line-height: normal;

                    &.for-toolbar-img,
                    &.for-toolbar-para,
                    &.for-toolbar-title,
                    &.for-toolbar-more,
                    &.for-toolbar-list {
                        position: relative;

                        > ul {
                            position: absolute;
                            top: 100%;
                            left: -50px;
                            width: 140px;
                            margin-top: 4px;
                            background: #fff;
                            border-radius: 4px;
                            box-shadow: rgba(0, 0, 0, 0.1) 0 2px 8px 0;
                            z-index: 99;
                            line-height: 2.8;
                            text-align: center;
                            list-style: none;

                            li {
                                position: relative;

                                &:hover {
                                    background: #e9e9e9;
                                }

                                &:first-child {
                                    border-radius: 4px 4px 0 0;
                                }

                                &:last-child {
                                    border-radius: 0 0 4px 4px;
                                }

                                input {
                                    position: absolute;
                                    width: 100%;
                                    opacity: 0;
                                    left: 0;
                                    top: 0;
                                    bottom: 0;
                                    cursor: pointer;
                                }
                            }
                        }
                    }

                    &.for-active {
                        background: #ddd;
                    }

                    &:hover {
                        cursor: pointer;
                        background: #e9e9e9;
                    }

                    i {
                        font-size: 1.2em;
                    }
                }
            }
        }
        > .for-pc {
            display: -webkit-box;
            display: flex;
            width: calc(100% - 110px);
            > ul {
                flex-wrap: wrap;
                width: 100%;
                align-content: flex-start;
                -webkit-box-orient: horizontal;
                -webkit-box-direction: normal;
                flex-direction: row;
            }
        }
        > .for-right-pc {
            display: -webkit-box;
            display: flex;
            width: 110px;
            > ul {
                display: -webkit-box;
                display: flex;
                -webkit-box-orient: horizontal;
                -webkit-box-direction: normal;
                flex-direction: row;
                -webkit-box-pack: end;
                justify-content: flex-end;
                -webkit-box-align: center;
                align-items: center;
            }
        }
        > .for-mobile {
            display: none;
            width: calc(100% - 75px);
            > ul {
                flex-wrap: wrap;
                width: 100%;
                align-content: flex-start;
                -webkit-box-orient: horizontal;
                -webkit-box-direction: normal;
                flex-direction: row;
            }
        }
        > .for-right-mobile {
            display: none;
            width: 75px;
            > ul {
                flex-wrap: wrap;
                width: 100%;
                align-content: flex-end;
                -webkit-box-orient: horizontal;
                -webkit-box-direction: normal;
                flex-direction: row;
            }
        }

        @media screen and (max-width: "900px") {
            > .for-pc {
                display: none;
            }
            > .for-mobile {
                display: -webkit-box;
                display: flex;
            }
            > .for-right-pc {
                display: none;
            }
            > .for-right-mobile {
                display: -webkit-box;
                display: flex;
            }
        }
    }

    .for-editor {
        display: -webkit-box;
        display: flex;
        -webkit-box-pack: justify;
        justify-content: space-between;
        height: 100%;
        color: #2c3e50;
        border-radius: 0 0 8px 8px;
        overflow: hidden;
        position: relative;

        .for-panel {
            height: 100%;
            -webkit-box-flex: 0;
            flex: 0 0 100%;
            overflow: auto;
            -webkit-transition: all 0.2s linear 0s;
            transition: all 0.2s linear 0s;
            position: relative;

            &.for-active {
                -webkit-box-flex: 0;
                flex: 0 0 50%;
            }

            .for-preview {
                min-height: 100%;
                box-sizing: border-box;
                padding: 10px 14px;
                background: #fcfcfc;
            }
        }

        // 新增大纲
        .for-outline-box {
            width: 30px;
            height: 30px;
            position: absolute;
            top: 15px;
            right: 30px;
            z-index: 999;
            background-color: white;
            border-radius: 3px;
            box-shadow: 0 0 2px grey;
            padding: 0px;
            -webkit-transition: height 1s, width 1s;
            transition: height 1s, width 1s;
            overflow: hidden;

            > .for-outline-title {
                height: 30px;
                width: 30px;
                display: -webkit-box;
                display: flex;
                -webkit-box-orient: horizontal;
                -webkit-box-direction: normal;
                flex-direction: row;
                -webkit-box-pack: start;
                justify-content: flex-start;
                -webkit-box-align: center;
                align-items: center;
                -webkit-transition: width 1s;
                transition: width 1s;
                > i {
                    font-size: 28px;
                }
            }
            > .for-outline-body {
                width: 100%;
                height: calc(100% - 30px);
                margin-top: 5px;
                overflow-x: hidden;
                overflow-y: scroll;
                &::-webkit-scrollbar {
                    display: none;
                }
                -ms-overflow-style: none;
                > ul {
                    height: 0px;
                    -webkit-transition-delay: 1s;
                    transition-delay: 1s;
                    -webkit-transition: height 1s;
                    transition: height 1s;
                    > li {
                        height: 35px;
                        display: none;
                        overflow: hidden;
                    }
                }
            }
        }

        .for-outline-box:hover {
            height: 300px;
            width: 200px;
            padding: 5px;
            > .for-outline-title {
                width: 100%;
                border-bottom: 1px solid #d6d6d6;
            }
            > .for-outline-body {
                padding-left: 5px;
                > ul {
                    height: 100%;
                    width: 100%;
                    display: -webkit-box;
                    display: flex;
                    -webkit-box-orient: vertical;
                    -webkit-box-direction: normal;
                    flex-direction: column;
                    -webkit-box-pack: start;
                    justify-content: flex-start;
                    -webkit-box-align: start;
                    align-items: flex-start;
                    padding-bottom: 5px;
                    > li {
                        display: -webkit-box;
                        display: flex;
                        -webkit-box-orient: horizontal;
                        -webkit-box-direction: normal;
                        flex-direction: row;
                        -webkit-box-pack: start;
                        justify-content: flex-start;
                        -webkit-box-align: center;
                        align-items: center;
                        margin-top: 3px;
                        -webkit-user-select: none;
                        -moz-user-select: none;
                        -ms-user-select: none;
                        user-select: none;
                        width: 100%;
                        padding-top: 5px;
                        padding-bottom: 5px;
                        overflow: hidden;
                        > a {
                            text-decoration: none;
                            color: black;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                            width: 90%;
                            overflow: hidden;
                        }
                        &:hover {
                            background-color: #f0f0f0;
                        }
                    }
                    > .for-outline-h1 {
                        > a {
                            font-size: 20px;
                            font-weight: 700;
                        }
                    }
                    > .for-outline-h2 {
                        margin-left: 0px;
                        > a {
                            font-size: 18px;
                            font-weight: 400;
                        }
                    }
                    > .for-outline-h3 {
                        margin-left: 5px;
                        > a {
                            font-size: 17px;
                            font-weight: 400;
                        }
                    }
                    > .for-outline-h4 {
                        margin-left: 10px;
                        > a {
                            font-size: 16px;
                            font-weight: 400;
                        }
                    }
                    > .for-outline-h5 {
                        margin-left: 15px;
                        > a {
                            font-size: 15px;
                            font-weight: 400;
                        }
                    }
                    > .for-outline-h6 {
                        margin-left: 20px;
                        > a {
                            font-size: 14px;
                            font-weight: 400;
                        }
                    }
                }
            }
        }

        // 编辑区域
        .for-editor-edit {
            line-height: 1.6;
            height: 100%;

            &.for-edit-preview {
                width: 0;
                -webkit-box-flex: 0;
                flex: 0 0 0;
            }
            .for-editor-block {
                display: -webkit-box;
                display: flex;
                min-height: 100%;
            }

            .for-line-num {
                list-style: none;
                background: #eee;
                padding: 8px 3px 120px;
                min-width: 30px;
                text-align: center;
                &.hidden {
                    display: none;
                }
                li {
                    list-style: none;
                }
            }

            .for-editor-content {
                -webkit-box-flex: 1;
                flex: 1;
                position: relative;
                height: 100%;
                margin-left: 10px;

                pre {
                    padding: 8px 0;
                    display: block;
                    white-space: pre-wrap;
                    word-wrap: break-word;
                    visibility: hidden;
                    margin: 0;
                    font-family: inherit;
                }
            }
        }
    }

    textarea {
        font-family: "Consolas", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
        // box-sizing: border-box;
        position: absolute;
        top: 8px;
        bottom: 0;
        // padding: 8px 0;
        border: none;
        display: block;
        height: auto;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        resize: none;
        border: none;
        outline: none;
        font-size: inherit;
        color: inherit;
        background: none;
        line-height: inherit;
    }

    .for-markdown-preview {
        line-height: 2;

        p,
        blockquote,
        ul,
        ol,
        dl,
        pre {
            margin-top: 0;
            margin-bottom: 0.6em;
        }

        h1,
        h2 {
            border-bottom: 1px solid #e2e2e2;
        }

        h1,
        h2,
        h3,
        h4,
        h5,
        h6 {
            padding: 0;
            margin: 0 0 0.6em;
            font-weight: 600;

            text-indent: 0;

            &:target {
                padding-top: 4.5rem;
            }
        }

        // 重写锚点部分样式
        .for-anchor {
            color: #74b9ff;
        }

        .for-heading:hover + .for-anchor {
            color: #0984e3;
        }

        .for-anchor:hover {
            color: #0984e3;
        }

        // 重写折叠块样式
        details {
            background-color: #f0f0f0;
            border-radius: 3px;
            padding: 0.6em;
        }
        summary {
            outline: none;
            cursor: pointer;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        // 写emoji包含的样式
        .for-para-emoji {
            display: -webkit-box;
            display: flex;
            -webkit-box-orient: horizontal;
            -webkit-box-direction: normal;
            flex-direction: row;
            -webkit-box-pack: start;
            justify-content: flex-start;
            -webkit-box-align: center;
            align-items: center;
            flex-wrap: wrap;
            align-content: flex-start;
            word-wrap: break-word;
            word-break: break-all;
            overflow: hidden;
            width: 100%;
            height: auto;
            > img {
                width: 22.4px;
                height: 22.4px;
                margin: 0;
                padding-left: 5px;
                padding-right: 5px;
            }
        }

        // Tex渲染分行
        .katex-html > .mspace {
            height: 10px;
        }

        // 写kbd样式
        kbd {
            background-color: white;
            box-shadow: 0 0 2px grey;
            padding: 3px;
            border-radius: 2px;
            font-weight: 600;
        }

        a {
            color: #0366d6;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }

        ul,
        ol {
            padding: 0.2em 0.8em;

            > li {
                line-height: 2;
                padding-left: 0.2em;
                margin-left: 0.2em;
                list-style-type: disc;

                > p {
                    text-indent: 0;
                }

                > ul {
                    &:last-child {
                        margin-bottom: 0;
                    }

                    li {
                        list-style-type: circle;

                        > ul li {
                            list-style-type: square;
                        }
                    }
                }
            }
        }

        > ul,
        ol {
            padding: 0 20px;
        }

        ol > li {
            list-style-type: decimal;
        }

        blockquote {
            margin: 0;
            margin-bottom: 0.6em;
            padding: 0 1em;
            color: #6a737d;
            border-left: 0.25em solid #dfe2e5;

            p {
                text-indent: 0;

                &:first-child {
                    margin-top: 0;
                }

                &:last-child {
                    margin-bottom: 0;
                }
            }
        }

        pre {
            padding: 0.6em;
            overflow: auto;
            line-height: 1.6;
            background-color: #fefbec;
            border-radius: 3px;

            code {
                padding: 0;
                margin: 0;
                font-size: 100%;
                background: transparent;
                overflow-x: scroll;
                &::-webkit-scrollbar {
                    display: none;
                }
                -ms-overflow-style: none;
            }
        }

        // 扩展diff语法样式
        .for-md-diff {
            padding: 0.6em;
            overflow: auto;
            line-height: 1.6;
            background-color: transparent;
            code {
                padding: 0;
                margin: 0;
                font-size: 100%;
                background: transparent;
                > p {
                    padding-left: 5px;
                    padding-right: 5px;
                }
                > .for-md-diff-add {
                    color: #22863a;
                    background-color: #f0fff4;
                }
                > .for-md-diff-del {
                    color: #b31d28;
                    background-color: #ffeef0;
                }
                > .for-md-diff-focus {
                    color: #e36209;
                    background-color: #ffebda;
                }
                > .for-md-diff-ignore {
                    color: #6a737d;
                    background-color: transparent;
                }
            }
        }

        code {
            padding: 0.2em 0.4em;
            margin: 0;
            background-color: #fefbec;
            border-radius: 3px;
        }

        hr {
            margin-bottom: 0.6em;
            height: 1px;
            background: #dadada;
            border: none;
        }

        table {
            width: 100%;
            border: 1px solid #ddd;
            margin-bottom: 0.6em;
            border-collapse: collapse;
            text-align: left;

            thead {
                background: #eee;
            }

            th,
            td {
                padding: 0.1em 0.4em;
                border: 1px solid #ddd;
            }
        }

        img {
            display: block;
            margin: 0 auto;
            max-width: 100%;
            margin-bottom: 0.6em;
        }
    }
}
